<?php

namespace Database\Seeders;

use App\Models\Admin\SysDict;
use App\Models\Admin\SysDictType;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class SysDictSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $types = [
            [
                'name' => '性别',
                'code' => 'gender',
                'status' => 1,
                'remark' => '0 女 1 男 2 未知',
            ],
            [
                'name' => '状态',
                'code' => 'status',
                'status' => 1,
                'remark' => '0 禁用 1 启用',
            ],
        ];

        $dicts = [
             [
                'type_code' => 'status',
                'name' => '正常',
                'value' => 1,
                'sort' => 0,
                'status' => 1,
                'is_default' => 0,
                'remark' => ''
            ],

            [
                'type_code' => 'status',
                'name' => '禁用',
                'value' => 0,
                'sort' => 0,
                'status' => 1,
                'is_default' => 0,
                'remark' => ''
            ],

            [
                'type_code' => 'gender',
                'name' => '男',
                'value' => 1,
                'sort' => 0,
                'status' => 1,
                'is_default' => 0,
                'remark' => ''
            ],

            [
                'type_code' => 'gender',
                'name' => '女',
                'value' => 0,
                'sort' => 0,
                'status' => 1,
                'is_default' => 0,
                'remark' => ''
            ],
            [
                'type_code' => 'gender',
                'name' => '未知',
                'value' => 2,
                'sort' => 0,
                'status' => 1,
                'is_default' => 0,
                'remark' => ''
            ],

        ];


        foreach($types as $type) {
            SysDictType::create($type);
        }

        foreach($dicts as $dict) {
            SysDict::create($dict);
        }
    }
}
